{% extends 'dashboard.html' %}

{% block content %}
 <div class="right_col" role="main">
          <div class="">

            <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  <div class="x_title">
                        <form id="demo-form2" data-parsley-validate  method="post" action="{{ url_for('dbreport', id=dbconfig.id) }}" onsubmit="javascript:if (confirm('确定要生成新报告?')) { return true } else { return false }">
                    <h2>{{ dbconfig.name }}数据库报告</h2>



                       {{ form.hidden_tag() }}
                      <ul class="nav navbar-middle panel_toolbox">
                          <li><label>内存：</label><input type="text" id="{{ form.mem.name }}" name="{{ form.mem.name }}" class="form-group-sm" placeholder="请输入数据库内存大小" required="required"/>MB&nbsp;&nbsp;<button type="submit" class="btn btn-success btn-sm" >生成报告</button></li>
                      </ul>
                      </form>
                    <div class="clearfix"></div>
                  </div>
                  <div class="x_content">

                    <table id="datatable-buttons" class="table table-striped table-bordered">

                      <thead>
                        <tr>
                          <th>创建时间</th>
                          <th>内存大小</th>
                          <th>操作</th>
                        </tr>
                      </thead>


                      <tbody>
                      {% for dbreport in dbreports %}
                        <tr>
                          <td>{{ dbreport.create_time }}</td>
                          <td>{{ dbreport.mem }}&nbsp;MB</td>
                          <td><button type="button" class="btn btn-info btn-sm" onclick="{location.href='{{ url_for('dbreport_view',id=dbreport.id) }}'}">查看</button><button type="button" class="btn btn-danger btn-sm" onclick="javascript:if (confirm('确定要删除?')) location.href='{{ url_for('dbreport_delete',dbid=dbconfig.id,id=dbreport.id) }}';">删除</button></td>
                        </tr>
                      {% endfor %}

                      </tbody>
                    </table>
                  </div>
                <button class="btn btn-primary btn-sm" type="button" onclick="{location.href='{{ url_for('mysql_db') }}'}">返回</button>
                </div>
              </div>

          </div>
        </div>
        <!-- /page content -->
{% endblock %}